Skip to content

Commit

Permalink
Allow URL params in internal links (FS#1967)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianheine committed Jun 17, 2010
1 parent a0070b5 commit 44653a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion inc/parser/xhtml.php
Expand Up @@ -559,6 +559,18 @@ function locallink($hash, $name = NULL){
function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktype='content') {
global $conf;
global $ID;

$params = array();

if (preg_match('/^([^?]*)\?([^?]+)$/', $id, $matches) !== false) {
$id = $matches[1];
preg_match_all('/(?<=[&^])([^=]+)=([^=]*)(?:&|$)/', $matches[2],
$matches, PREG_SET_ORDER);
foreach($matches as &$param) {
$params[$param[1]] = $param[2];
}
}

// default name is based on $id as given
$default = $this->_simpleTitle($id);

Expand Down Expand Up @@ -592,7 +604,7 @@ function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktyp
}
$link['more'] = '';
$link['class'] = $class;
$link['url'] = wl($id);
$link['url'] = wl($id, $params);
$link['name'] = $name;
$link['title'] = $id;
//add search string
Expand Down

0 comments on commit 44653a5

Please sign in to comment.